home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / User Contributions / applescript-from-lisp / READ ME About Applescript.lisp < prev   
Encoding:
Text File  |  1994-06-16  |  2.4 KB  |  50 lines  |  [TEXT/CCL2]

  1. The file applescript.lisp defines some classes and methods for running
  2. applescript scripts from Lisp.  In order to make this magic happen you need to
  3. add the file OSA.LISP to ccl:library;interfaces; and then call (reindex-interfaces).  
  4.  
  5. There is a loader file called applescript-loader.lisp.  It will expect to find
  6. the files AEStuff, AppleScript, Utils and AppleScript editor, in the folder
  7. ccl:applescript/appleevents;. I assume that you have the files "appleevent-toolkit",
  8. "scrolling-fred-dialog-item" and "scrollers" which are all part of MCL and that
  9. they are accessible when called by require.
  10.  
  11.  
  12. Note that this stuff is still under construction and there may be memory
  13. problems.  I haven't done all the error handling and cleanup that I want but the
  14. code is still quite functional.  There is an example at the end of
  15. applescript.lisp which illustrates how to create an applescript instance, 
  16. compile and run the script. 
  17.  
  18. The file called applescript-editor.lisp contains defs for a little applescript
  19. editor window.  Please note that if you call edit-script on an applescript
  20. instance, any script in the script slot will be shown in the editor.  If you put
  21. the script into the object when you create the object, you need to put in the
  22. escape character \ before anything which is quoted within the script string. 
  23. You do not do this in the applescript editor.  E.g.,
  24.  
  25. (setf testObj (make-instance 'as::applescript-object
  26.                 :script "Tell application \"Eudora\" to reply message 4 of mailbox \"in\" of mail folder \"\""
  27.         :application-name "Eudora"))
  28.  
  29. whereas in the editor you would simply write:
  30.  
  31.     Tell application "Eudora" to reply message 4 of mailbox "in" of mail folder ""
  32.  
  33.  
  34. the "Show the Result" check box just directs the result (whatever that may be) to the lisp listener
  35. Note that the value of the result of sending the script is always stored in the returned.value
  36. slot of the applescript instance (accessor is returned-value)
  37.  
  38. I have also added recording to the functionality on an applescript object. 
  39. Example code is shown.  Basically this allows you to create an applescript
  40. object with no script, turn recording on and have the script automatically get
  41. generated and stuffed into the applescript object.  You can view the script
  42. also.
  43.  
  44. There is lots left to do and implement - think of all this as a framework for
  45. using applescript from lisp.  
  46.  
  47. Please send comments to me (bonura@apple.com).  Enjoy.
  48.  
  49. Tom Bonura
  50. Apple Computer, Inc.